package edu.hawaii.duedates.library;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * The LibraryOption class is used to provide a library option group to the
 * web application.
 * 
 * @author Ronn Reeves
 */
public class LibraryOption implements Serializable {
  /** Unique identifier for this instance. */
  private static final long serialVersionUID = 1L;

  /** The library option. */
  private ILibrary library;
  
  /** Email flag. */
  private Boolean selected;

  /**
   * Creates a list of library options.
   * 
   * @param libraries The list of libraries.
   * @return The library options.
   */
  public static List<LibraryOption> getOptions(List<ILibrary> libraries) {
    List<LibraryOption> options = new ArrayList<LibraryOption>(); 
    for (ILibrary library : libraries) {
      LibraryOption option = new LibraryOption();
      option.setLibrary(library);
      options.add(option);
    }
    return options;
  }
  
  /**
   * Sets the library option.
   * @param library The library.
   */
  public void setLibrary(ILibrary library) {
    this.library = library;
  }

  /**
   * Gets the library.
   * @return The library.
   */
  public ILibrary getLibrary() {
    return this.library;
  }
  
  /**
   * Sets the email flag.
   * @param selected The email status.
   */
  public void setEmailStatus(Boolean selected) {
    this.selected = selected;
  }

  /**
   * Gets the email flag.
   * @return The email status.
   */
  public Boolean getEmailStatus() {
    return this.selected;
  }
}